<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
//System.out.println("SESSION_SECURITY_CODE"+request.getSession().getAttribute("SESSION_SECURITY_CODE"));
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>注册</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="scripts/jquery-1.9.1.min.js" language="javascript"></script>
	<script type="text/javascript" src="scripts/Validform_v5.3.2_min.js"></script>
	<link rel="stylesheet" type="text/css" href="style/Validform_v5.3.2_css.css">

	<script type="text/javascript">
	$(function() {
		$("#codeImage").click(function() {
			this.src = "system/codeImage.shtml?timestamp=" + new Date().getTime();
		});
		$("#securityCode").change(function() {
			this.ajaxurl="system/checkCodeImage.shtml?securityCode="+document.getElementById("securityCode").value;
		});
		$("#dlzh00").change(function() {
			this.ajaxurl="system/checkUserName.shtml?userName="+document.getElementById("dlzh00").value;
		});
		
		
		$(".ylzform").Validform({
			tiptype:function(msg,o,cssctl){
			//msg：提示信息;
			//o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
			//cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
			if(!o.obj.is("form")){//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
				var objtip=o.obj.siblings(".Validform_checktip");
				cssctl(objtip,o.type);
				objtip.text(msg);
			}
		}
		});
	})
	function valiImgCode(){
		alert(document.getElementById("securityCode").value);
		$.ajax({
			type : "POST",
			dataType : "json",
			data : "securityCode=" + document.getElementById("securityCode").value,
			url : 'system/checkCodeImage.shtml', // 请求的处理数据//register
			success : function(data) {
				if(data.checkMsg =="success"){
				 alert("验证正确!");	
				}else{
				  alert("验证错误!!");
				  document.getElementById("securityCode").value="";
				}
			},
			error : function(XMLHttpRequest, textStatus, errorThrown) {
				alert(errorThrown);
			}
		});
	}
	</script>
	<style type="text/css">
	  .red {color: #f00;}
	  .pr5 {padding-left: 5px;}
	  ol {list-style-type: none; list-style-image: none;}
	</style>

  </head>
  
  <body>
    <div class="layout">
			<!--页面内容  -->
			<div class="content_wrapper " style="width: 930px; height: 446px;">
				<div class="ptb10">
					<h3 style="color: #FF7E00; font: 22px/ 1.1 微软雅黑, 黑体, 文泉驿黑体;">
						用户注册
					</h3>
					<hr class="hr_dashed_1" />
				</div>
				<form class="ylzform"  method="post" action="system/userRegister.shtml">
					<fieldset>
						<ol>
							<li>
								<label class="form_th">
									<font class="red pr5">*</font>用户帐号:
								</label>
								<input id="dlzh00" type="text" name="user.zhm000" value="${user.zhm000 }"  
								class="inputxt" ajaxurl="system/checkUserName.shtml" nullmsg="请输入用户名!" datatype="s3-18" errormsg="用户名至少3个字符,最多18个字符!"/>
								<div class="Validform_checktip">用户名至少3个字符,最多18个字符</div>
							</li>
							<li>
								<label class="form_th">
									<font class="red pr5">*</font>设置密码:
								</label>
								<input id="dlmm00" type="password" name="user.zhmm00" 
								class="inputxt" datatype="*6-16" nullmsg="请设置密码！" errormsg="密码范围在6~16位之间！" />
								<div class="Validform_checktip"></div>
							</li>
							<li>
								<label class="form_th">
									<font class="red pr5">*</font>确认密码:
								</label>
								<input id="checkPwd" class="ylz_input" type="password" name="password2"
								 class="inputxt" datatype="*6-16" recheck="user.zhmm00"  nullmsg="请再输入一次密码！" errormsg="您两次输入的账号密码不一致！"/>
								<div class="Validform_checktip">密码2</div>
							</li>
							<li>
								<label class="form_th">
									<font class="red pr5">*</font>电子邮箱:
								</label>
								<input id="email0" class="ylz_input" type="text" name="user.yxdz00" datatype="e" nullmsg="请输邮箱!" errormsg="邮箱格式错误!"/>
							    <div class="Validform_checktip"></div>
							</li>
							<li>
								<label class="form_th"><font class="red pr5">*</font>验证码:</label>
								<input id="securityCode" class="check_code" type="text" name="securityCode" onchange=""
								 datatype="s4-4" ajaxurl="system/checkCodeImage.shtml?securityCode=" nullmsg="请输入验证码!" errormsg="验证码错误"/>
								<span class="check_code_img mlr10"><img src="system/codeImage.shtml" id="codeImage" alt="点击图片刷新验证码"/></span>
								<span>点击图片刷新验证码</span>
								<div class="Validform_checktip"></div>
							</li>
							<li style="padding-top: 10px;">
								<label class="form_th">&nbsp;</label>
								<input value="立即注册" class="button mr5 mt10" type="submit" id="button"   />
								<input value="验证验证码" class="button mr5 mt10" type="button" onclick="valiImgCode()" />
							</li>
							<li class="clr"></li>
						</ol>
					</fieldset>
				</form>
				<!---->
			</div>
		</div>
  </body>
</html>
